#!/bin/bash

if [ ! -z $SERVER_NAME ]; then
    sed -i -e "s/#server_name\s*localhost;/server_name ${SERVER_NAME};/g" /etc/nginx/conf.d/www.conf
fi

if [ ! -z $document_root ]; then
    sed -i -e "s#\#root\s*document_root;#root ${document_root};#g" /etc/nginx/conf.d/www.conf
fi

#run supervisord
/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf
